# coding:utf-8
from __future__ import print_function


class Node:
    def __init__(self, data=None, left=None, right=None):
        self.data = data
        self.left = left
        self.right = right


def breath_traverse(node):  # 广度遍历
    if node is None:
        return []
    print(node.data, end='')
    result = [node]
    middle_node = result.pop(0)
    if middle_node.left is not None:
        breath_traverse(node.left)
    if middle_node.right is not None:
        breath_traverse(node.right)


def depth_traverse():  # 深度遍历
    q = Queue.Queue()
    for i in range(5):
        q.put(i)
    while not q.empty():
        print(q.get())


if __name__ == '__main__':
    node3 = Node(data=3)
    node4 = Node(data=4)
    node1 = Node(data=1, left=node3, right=node4)
    node2 = Node(data=2)
    node0 = Node(data=0, left=node1, right=node2)
    breath_traverse(node0)
